<template>
<div>
    <Row :gutter="16">
        <Col span="8" v-if="checkPermission('1132')">
            <infor-card class="mesbox" idName="toServiceRegisterCheck" iconType="ios-help" color="#f25e43" 
                :val="serviceRegisterCheckCount" val-text="待审核的服务机构" :val-router="{name:'service_register_check'}" 
                :totalVal="serviceRegisterCheckTotalCount" total-text="服务机构总数" :total-router="{name:'member_manage',query:{role_type:'5'}}" 
                :monthVal="serviceRegisterCheckCountMonth"></infor-card>
        </Col>
        <Col span="8" v-if="checkPermission('1109')">
            <infor-card class="mesbox" idName="toFirmCheck" iconType="ios-help" color="#f25e43" 
                :val="firmCheckCount" val-text="待审核的企业" :val-router="{name:'firm_check'}" 
                :totalVal="firmCheckTotalCount" total-text="企业总数" :total-router="{name:'member_manage',query:{role_type:'4'}}" 
                :monthVal="firmCheckCountMonth" ></infor-card>
        </Col>
        <Col span="8" v-if="checkPermission('1111')">
            <infor-card class="mesbox" idName="toDemandCheck" iconType="ios-briefcase" color="#64d572" 
                :val="demandCheckCount" val-text="待审核需求" :val-router="{name:'demand_check'}"
                :totalVal="demandCheckTotalCount" total-text="需求总数" :total-router="{name:'demand_history'}"
                :monthVal="demandCheckCountMonth"></infor-card>
        </Col>
        <Col span="8" v-if="checkPermission('1110')">
            <infor-card class="mesbox" idName="toServiceCheck" iconType="ios-telephone" color="#ffd572" 
                :val="ServiceCheckCount" val-text="待审核服务" :val-router="{name:'service_check'}" 
                :totalVal="ServiceCheckTotalCount" total-text="服务总数" :total-router="{name:'service_history'}" 
                :monthVal="ServiceCheckCountMonth"></infor-card>
        </Col>
        <Col span="8" v-if="checkPermission('1123')">
            <infor-card class="mesbox" idName="newFeedback" iconType="email" color="#2d8cf0" 
                :val="newFeedBackCount" val-text="新的反馈" :val-router="{name:'feedback_manage',query:{status:1}}"
                :totalVal="newFeedBackTotalCount" total-text="反馈总数" :total-router="{name:'feedback_manage'}"
                :monthVal="newFeedBackCountMonth"></infor-card>
        </Col>
        <Col span="8" v-if="checkPermission('1104')">
            <infor-card class="mesbox" idName="memberCount" iconType="ios-people" color="#f25e43"
                :val="memberCount" val-text="待认证会员" :val-router="{name:'member_manage',query:{status:'1'}}"
                :totalVal="memberTotalCount" total-text="会员总数" :total-router="{name:'member_manage'}"
                :monthVal="memberCountMonth"></infor-card>
        </Col>
    </Row>
</div>
</template>

<script>
import Parent from '../Parent'
import InforCard from '@/common/components/inforCard.vue'
import CountUp from '@/common/components/countUp.vue'

export default {
    extends: Parent,
    components:{
        InforCard, CountUp
    },
    data() {
        return {
            newFeedBackCount: 0,
            firmCheckCount: 0,
            serviceRegisterCheckCount: 0,
            ServiceCheckCount:0,
            demandCheckCount:0,
            memberCount:0,

            newFeedBackTotalCount: 0,
            firmCheckTotalCount: 0,
            serviceRegisterCheckTotalCount: 0,
            ServiceCheckTotalCount:0,
            demandCheckTotalCount:0,
            memberTotalCount:0,

            newFeedBackCountMonth: 0,
            firmCheckCountMonth: 0,
            serviceRegisterCheckCountMonth: 0,
            ServiceCheckCountMonth:0,
            demandCheckCountMonth:0,
            memberCountMonth:0,
            countDictionary:{},
        };
    },
    methods: {
        toFirmCheck(){
            this.$router.push({ name: "firm_check"});
        },
        toServiceRegisterCheck(){
            this.$router.push({ name: "service_register_check"});
        },
        toFeedback(){
            this.$router.push({ name: "feedback_manage"});
        },
        toServiceCheck(){
            this.$router.push({ name: "service_check"});
        },
        toDemandCheck(){
            this.$router.push({ name: "demand_check"});
        },
        toMemberManage(){
            this.$router.push({ name: "member_manage"});
        },
    },
    created() {
        this.api.post("admin/overview",null,res=>{
            this.newFeedBackCount = res.data["unProcessed_count"];
            this.firmCheckCount = res.data["firm_examining_count"];
            this.serviceRegisterCheckCount = res.data["service_register_examining_count"];
            this.ServiceCheckCount = res.data["service_count"];
            this.demandCheckCount = res.data["demand_examining_count"];
            this.memberCount = res.data["member_count"];

            this.newFeedBackTotalCount = res.data["unProcessed_totalcount"];
            this.firmCheckTotalCount = res.data["firm_examining_totalcount"];
            this.serviceRegisterCheckTotalCount = res.data["service_register_examining_totalcount"];
            this.ServiceCheckTotalCount = res.data["service_totalcount"];
            this.demandCheckTotalCount = res.data["demand_examining_totalcount"];
            this.memberTotalCount = res.data["member_totalcount"];
        });
        this.api.post("statistics/monthCount",null,res=>{
            this.countDictionary = res.data;
            this.newFeedBackCountMonth = this.countDictionary["feedback_month"];
            this.firmCheckCountMonth = this.countDictionary["firm_month"];
            this.serviceRegisterCheckCountMonth = this.countDictionary["service_register_month"];
            this.ServiceCheckCountMonth = this.countDictionary["service_month"];
            this.demandCheckCountMonth = this.countDictionary["demand_month"];
            this.memberCountMonth = this.countDictionary["member_month"];
        });
    }

}
</script>

<style>

</style>
